import { View } from '@tarojs/components';
import './index.css';
import { useEffect } from 'react';
import { Toast } from '@/util';
import { Button } from '@taroify/core';
import '@taroify/core/index.scss';
import { useSelector } from 'react-redux';
import { selectLoginAccountInfo } from '@/store/reducer/LoginAccountInfoReducer';

function Home() {
  const loginAccountInfo = useSelector(selectLoginAccountInfo);

  useEffect(() => {
    console.log(JSON.stringify(loginAccountInfo));
    Toast.success(`Hello ${loginAccountInfo?.nickname ?? 'Home'}`);
  }, []);

  return (
    <View className="home-page">
      <Button
        size={'small'}
        onClick={() => Toast.info('Hello Home Page')}
        color={'primary'}
      >
        Hello Home Page !
      </Button>
    </View>
  );
}

export default Home;
